﻿using System;
using System.Linq;
using System.Linq.Expressions;

namespace Rob.SampleCode.NHibernate.Core
{
    public interface IRepository
    {
        T Get<T>(int id);
        T Get<T, K>(K id) where T : IKeyed<K>;
        T Get<T>(Expression<Func<T, bool>> predicate);

        IQueryable<T> Find<T>();
        IQueryable<T> Find<T>(Expression<Func<T, bool>> predicate);

        T Add<T>(T entity);
        T Remove<T>(T entity);
    }

    public interface IKeyed<out T>
    {
        T Id { get; }
    }
}